{% extends "base.html" %}


{% block title %}{{ page.title }}{% endblock title %}


{% block header_logo %}
<p class="header-title">{{ config.title }} | {{ page.title }}</p>
{% endblock header_logo %}


{% block content %}


<!-- List parent -->
{% set current_path = page.path %}
{% if "/" in current_path %}

{% set last_char = current_path | split(pat="/") | last %}
{% if last_char == "" %}
{% set parent_dirs = current_path | split(pat="/") | slice(end=-2) %}
{% else %}
{% set parent_dirs = current_path | split(pat="/") | slice(end=-1) %}
{% endif %}

{% set parent_href = parent_dirs | join(sep="/") %}
<a href="{{ parent_href }}">Back up</a>
{% endif %}


<!-- Table of Contents -->
{% if page.toc %}
<div>
  <p>Table of Contents</p>
  <ul>
    {% for h1 in page.toc %}
    <li>
      <a href="{{ h1.permalink | safe }}">{{ h1.title }}</a>
      {% if h1.children %}
      <ul>
        {% for h2 in h1.children %}
        <li>
          <a href="{{ h2.permalink | safe }}">{{ h2.title }}</a>
        </li>
        {% endfor %}
      </ul>
      {% endif %}
    </li>
    {% endfor %}
  </ul>
</div>
{% endif %}


{{ page.content | safe }}


{% endblock content %}
